﻿using SAD_Assignment1.BLO;
using SAD_Assignment1.DTO;
using SAD_Assignment1.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SAD_Assignment1.Public
{
    public partial class UserInfo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                initComponent();
            }
        }

        private void initComponent()
        {
            int accID = 0;
            try { accID = Int32.Parse(Request.Params["ID"]); }
            catch (Exception) { }
            AccountBLO accBLO = new AccountBLO();
            UserDTO userDTO = accBLO.getUserInfo(accID);
            if (userDTO == null)
            {
                Response.Redirect(Resource.Error);
                return;
            }
            txtEmail.Text = userDTO.Email;
            txtName.Text = userDTO.Name;
            txtRoles.Text = userDTO.Roles;
            txtPhotoCount.Text = userDTO.PhotoCount.ToString();
            txtPhotoLikeCount.Text = userDTO.PhotoLikeCount.ToString();
            txtPhotoUnlikeCount.Text = userDTO.PhotoUnlikeCount.ToString();
        }
    }
}